/*
 * The public types of cacheflex, they are expected to be used
 * by the final users.
 */
#ifndef __CACHEFLEX_BASE_TYPES__
#define __CACHEFLEX_BASE_TYPES__
#include <sys/types.h>
#include <stdint.h>

typedef void *(*cf_generic_alloc_pt)(size_t size);
typedef void (*cf_generic_free_pt)(void *ptr);
typedef void (*cf_scan_callback_pt)(void *key, void *value, void *args);
typedef void (*cf_write_log_pt)(int level, const char *format, ...);

typedef struct cf_kv_ops
{
    /* Default to the sizeof operator in C. */
    int64_t (*sizeof_key)(void *key);
    /* Default to memcpy() in libc. */
    void *(*copy_key)(void *key, void *buffer);
    /* Default to free() in libc. */
    void *(*destroy_key)(void *key);
    /* Default to the sizeof operator in C. */
    int64_t (*sizeof_value)(void *value);
    /* Default to memcpy() in libc. */
    void *(*copy_value)(void *value, void *buffer);
    /* Default to free() in libc. */
    void *(*destroy_value)(void *value);
    /* Default to the original value of @key. */
    int64_t (*hash_key)(void *key);
    /* Default to memcmp() in libc. */
    int (*compare_key)(void *a, void *b);
} cf_kv_ops_t;

struct cf_ref_handle;
typedef struct cf_ref_handle cf_ref_handle_t;
struct cf_index_interface;
struct cf_store_interface;
struct cf_reclaim_interface;

#ifndef __CACHEFLEX_DEVEL_FRAME_TYPES__
    typedef struct cf_index_interface cf_index_interface_t;
    typedef struct cf_store_interface cf_store_interface_t;
    typedef struct cf_reclaim_interface cf_reclaim_interface_t;
#endif
typedef enum
{
    CF_KV_STORE_SINGLE    = 0,
    CF_KV_STORE_MULTI     = 1,
} cf_kv_store_type_t;

typedef enum
{
  CF_DEBUG    = 0,
  CF_TRACE    = 1,
  CF_INFO     = 2,
  CF_WARN     = 3,
  CF_ERROR    = 4,
} cf_log_level_t;

struct cacheflex;
#ifndef __CACHEFLEX_INTERNAL_TYPES__
typedef struct cacheflex cacheflex_t;
#endif


#endif // __CACHEFLEX_BASE_TYPES__

